<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>

<?php
    $AuthorID = $_GET['id'];
    
    require 'lib/util.php';
    
    $sql = "SELECT ID, FirstName, MiddleName, LastName FROM ref_AUTHORS WHERE ID = " . $AuthorID;
    $rs = executeSqlQuery($sql);
    $rowCount = mysql_num_rows($rs);
    
?>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/style.css">
        <title></title>
    </head>
    <body>
        <?php
            session_start();
            include("/common/headerPage.php")
        ?>
        <div>
            <div id="menu_wrapper"><a href="index.php"><img src="images/home_icon.png" width="20px" height="20px" /></a></div>
            <div id="content_wrapper">
                <div id="fh_regular">Edit Author</div>
                
                <?php
                    if(isset($_SESSION['InfoMsg']))
                    {
                        echo $_SESSION['InfoMsg'];
                        unset($_SESSION['InfoMsg']);
                    }
                    if ($rowCount == 1)
                    {
                        while ($row = mysql_fetch_array($rs))
                        {
                ?>
                        
                <form method="post" action="func/refEditAuthorHandler.php">
                    <table>
                        <tr>
                            <td class="text_reg">First Name</td>
                            <td class="text_reg"><input type="text" name="txtAuthorFirstName" value="<?php echo $row['FirstName'] ?>" /></td>
                            <td class="text_reg">Middle Name</td>
                            <td class="text_reg"><input type="text" name="txtAuthorMiddleName" value="<?php echo $row['MiddleName'] ?>" /></td>
                        </tr>
                        <tr>
                            <td class="text_reg">Last Name</td>
                            <td class="text_reg"><input type="text" name="txtAuthorLastName" value="<?php echo $row['LastName'] ?>" /></td>
                            <td><input type="hidden" name="txtAuthorID" value="<?php echo $row['ID'] ?>" /></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><input class="text_reg" type="submit" name="btnUpdateAuthor" value="Update" /></td>
                            <td><input class="text_reg" type="submit" value="Remove" /></td>
                            <td></td>
                        </tr>
                    </table>
                </form>
                <?php
                        }
                    }
                ?>
            </div>
        </div>
    </body>
</html>
